package org.demo.transactional.service.impl;

import org.demo.transactional.dao.IUserMapper;
import org.demo.transactional.domain.User;
import org.demo.transactional.service.IUserMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserMapperService implements IUserMapperService {
    @Autowired
    private IUserMapper  userMapper;
    @Transactional
    @Override
    public int addUser(List<User> userList) {
        for (User user : userList) {
            userMapper.addUser(user);
        }
        return userList.size();
    }
}
